home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / os2 / pmcstex.zip / PM_BINS.ZIP / CYKL!.CMD < prev    next >
OS/2 REXX Batch file  |  1996-02-02  |  1KB  |  47 lines

  1. /* 
  2.   USAGE:   cykl!  FILE COMMAND
  3.  
  4.   The following REXX program does forever (till Ctrl/C or kill):
  5.     - waits till FILE changes its size or time (i.e. till saving on the disk)
  6.     - then it runs COMMAND
  7.  
  8.   IMPORTANT: if COMMAND is .cmd file, then it must be COMMAND = call the_command
  9.  
  10.   Requirements: priority.exe program from fm2utils (or any equivalent). 
  11.     This makes the difference between cykl!.cmd and cykl.cmd
  12.  
  13.   Main purpose with example:
  14.   cykl! seminar.tex call cslatex seminar
  15.     => - wait till you save file  seminar.tex  from the editor, then run 
  16.          LaTeX on it (and dvipm updates the page, WONDERFUL TeX-ING!
  17.  
  18.   Another example:
  19.   cykl! hello.c make
  20.  
  21.   Written by Petr Mikulik@sci.muni.cz, Brno, Dec 1995/Jan 1996
  22.   Je to muj prvni REXX program, hura, a konecne jede!
  23. */
  24.  
  25. /*'@echo off'*/
  26. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  27. call SysLoadFuncs
  28.  
  29. Call On Halt Name SignalHandler
  30. parse arg WhichFile WhichCommand
  31.  
  32. WhichFile = translate(WhichFile,'\','/') /* convert from unix format */
  33.  
  34. OldTime = ' '
  35. OldSize = ' '
  36. do forever
  37.   call SysFileTree WhichFile, 'file', 'FT'
  38.   OldTime = translate(word(file.1,1))
  39.   OldSize = translate(word(file.1,2))
  40.   WhichCommand
  41.   say "-----------------------------------------------------"
  42.   say "Cykl: Waiting for file change... (or close or Ctrl/C)"
  43.   priority 1 0 call cykl_in.cmd WhichFile OldTime OldSize
  44. end
  45. end
  46. SignalHandler:
  47.